package main

import (
	"fmt"
	"log"
	"net/rpc"
)

// 传的参数
type Params struct {
	Width  int
	Height int
}

func main() {
	// 1.连接远程rpc服务
	conn, err := rpc.DialHTTP("tcp", ":8080")
	if err != nil {
		log.Fatal(err)
	}

	//2.调用方法
	//面积
	var area = 0
	conn.Call("Rect.Area", Params{50, 100}, &area)
	fmt.Println("面积：", area)

	//周长
	var perimeter = 0
	conn.Call("Rect.Perimeter", Params{50, 100}, &perimeter)
	fmt.Println("面积：", perimeter)

}
